<template>
	<view>
		<Navbar></Navbar>
		<view class="u-m-30">
			<ActivityList :list="list" @goActivityDetial="goActivityDetial"></ActivityList>
		</view>
		<Loadmore :status="status"></Loadmore>
		<Bottom :isReturn="true"></Bottom>
	</view>
</template>

<script>
	import Navbar from '@/components/Navbar.vue'
	import Bottom from '@/components/Bottom.vue'
	import Loadmore from '@/components/Loadmore.vue'
	import reachBottom from '@/mixins/reachBottom.js'
	import ActivityList from '@/pages/demand/component/ActivityList.vue'
	import { getActivityList } from '@/network/demand.js'
	export default{
		mixins:[reachBottom],
		components:{
			Navbar,
			Bottom,
			ActivityList,
			Loadmore
		},
		data(){
			return{
				status: 'loadmore',
				list: []
			}
		},
		onLoad(){
			this.getCollegeList()
		},
		methods:{
			getCollegeList(){
				const params = {
					page: this.page,
					limit: this.pageSize,
					is_president: 1
				}
				getActivityList(params).then(res=>{
					this.count = res.data.count
					res.data.list.map(item => this.list.push(item))
					if (this.count = this.list.length) this.status = 'nomore'
				})
			},
			goActivityDetial(val) {
				uni.navigateTo({
					url: "/pages/activityDetail/activityDetail?id=" + val.id + '&isBack=true'
				})
			},
			loadData(){
				if(this.status == 'nomore'){
					return
				}else{
					this.page++
					this.getCollegeList()
				}
			}
		}
	}
</script>

<style>
</style>